package com.kx.smartdevice.mapper;

import com.kx.smartdevice.pojo.Category;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Set;

/**
 * @ClassName CategoryMapper
 * @Author Sun
 * @Date 2021/5/27 21:51
 */
public interface CategoryMapper {

    @Select("SELECT * FROM categories")
    Set<Category> findAllCategories();
    @Insert("INSERT INTO categories (categoryname,txcommand,rxcommand,status) VALUES(#{categoryname},#{txcommand},#{rxcommand},#{status})")
    void addCategory(Category category);

    int deleteCategory(@Param("ids") String[] ids);

    @Update("update categories set categoryname=#{categoryname},txcommand=#{txcommand},rxcommand=#{rxcommand},status=#{status} where id=#{id}")
    int updateCategory(Category category);

}
